using System;
using System.Web.Mvc;
using AspNetMvcViewBestPractices.Mappers;
using AspNetMvcViewBestPractices.Models;

namespace AspNetMvcViewBestPractices.Controllers
{
    public class ProductController : Controller
    {
        public ActionResult Index()
        {
            Product product = new Product();
            Random random = new Random();
            product.UnitsInStock = random.Next(0, 30);
            return View(product);
        }

        public ActionResult DisplayProductUsingMapper()
        {
            Product product = new Product();
            Random random = new Random();
            product.UnitsInStock = random.Next(0, 30);

            ProductDto productDto = ProductDtoMapper.Map(product);
            return View(productDto);
        }
    }
}
